package MaratImpl;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

import org.omg.CORBA.ORB;
import org.omg.CORBA.Object;

import PackMarathon.marathon;
import PackMarathon.marathonHelper;
import PackMarathon.marathonPackage.Personne;
import PackMarathon.marathonPackage.participantsHolder;



public class Client {
	static marathon href;
	
	public static void main(String[] args) throws IOException {
		ORB orb = ORB.init(args, null);
		
		BufferedReader br = new BufferedReader(new FileReader("FicPourIOR"));
		String ior = br.readLine();
		
		
		br.close();
		Object obj = orb.string_to_object(ior);
		href = marathonHelper.narrow(obj);
			
		Personne p1 = new Personne("Coquerelle", "Mathias");
		Personne p2 = new Personne("Jean", "Rene");
		
		href.inscrire_coureur(p1);
		href.inscrire_coureur(p2);
		participantsHolder p = new participantsHolder();
		
		href.liste_des_coureurs(p);
		
		for(Personne personne : p.value){
			System.out.println("- " + personne.nom + " " + personne.prenom+ " \n");
			
		}
		
		
	}
	
}
